package com.dingteam.question.common.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.dingteam.question.common.domain.QuestionItem;
import com.dingteam.question.common.domain.QuestionItemOption;
import com.dingteam.question.common.enums.ModuleEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 提交投票问卷的数据
 * @author Jamin
 * @date 2019/07/03
 */
@Getter
@Setter
@ToString
public class QuestionResultVerifyDTO implements Serializable {

	private static final long serialVersionUID = -6275416573235683541L;


	/** 问卷项目信息 */
	@Valid
	@NotEmpty
	private List<ItemResultDTO> items;



	@Getter
	@Setter
	@ToString
	public static class ItemResultDTO implements Serializable {

		private static final long serialVersionUID = 5866492065763342376L;

		@NotBlank
		private String itemId;

		private String content;

		/** 控件的类型 */
		@JsonIgnore
		@JSONField(serialize = false)
		private ModuleEnum moduleEnum;

		/** 控件的排序值 */
		@JsonIgnore
		@JSONField(serialize = false)
		private Integer order;

		/** 是否需要当前项 */
		@JsonIgnore
		@JSONField(serialize = false)
		private Boolean remove;

		/** 当前项 */
		@JsonIgnore
		@JSONField(serialize = false)
		private QuestionItem questionItem;

		/** 问卷明细的id */
		@Valid
		private List<OptionResultDTO> options;

	}

	@Getter
	@Setter
	@ToString
	public static class OptionResultDTO implements Serializable {

		private static final long serialVersionUID = -348923344504217645L;

		/** 选项的ID */
		@NotBlank
		private String optionId;

		/** 其他选项的补充内容 */
		private String otherItem;

		/** 数据对应的选项信息 */
		@JsonIgnore
		@JSONField(serialize = false)
		private QuestionItemOption itemOption;
	}

}
